Skip to content

id-caps: runtime feature-object library attachment registry (#12640) - #12896

Merged
dezren39 merged 1 commit into
mainfrom
lane-el/12640-library-attach
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-el/12640-library-attach

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements the first slice of #12640: the runtime feature-object library attachment mechanism from the #6003 design note (adopted 2026-11-22), as a pure registry state machine in a new id-caps module, library_attach.

What lands

  • AttachmentRegistry — per-world registry of entities, live attachments, staged changes, and namespaced library state.
  • Tick-boundary attach/detach (design note §1): changes stage when requested and apply only at begin_tick(); the TickSnapshot handed out at the boundary is what invocations resolve against, so a detach never pulls behaviour from an in-flight invocation. Attach/detach are authorized for the entity owner or a world author holding an explicit attach capability on the entity's class. Refused attaches stage nothing (atomic).
  • Attach-time capability intersection (§2): a library's requirement footprint must fit inside (entity held caps ∩ world ceiling); a widening attach is refused with the widening capabilities named exhaustively. Borrowing a library never borrows its author's privileges — the offer's footprint is the only thing judged.
  • Namespaced state (§3): keyed by (entity, library, major version). Detach keeps state inert and a same-major reattach revives it; a minor upgrade carries state live when a migration is declared, otherwise keeps it inert and flagged; a major upgrade parks state until the entity owner adopts it into the new major or drops it. Owner-only adopt/drop; no silent migration, no silent drop.
  • LibraryOffer::from_manifest builds an offer from a parsed LibraryManifest (identity = content hash, footprint = declared requirements, version parsed fail-closed).

Verification (laptop, nix develop in pkgs/id): cargo test -p id-caps library_attach — 20 passed / 0 failed, each test naming its oracle (the design-note rule it checks); full cargo test -p id-caps — 199 passed / 0 failed; cargo fmt -p id-caps -- --check clean after fmt.

Not in this slice (named on #12640): runtime wiring — invocation dispatch through the snapshot in id-worlds, execution of declared migrations (modelled here by their contract), and persistence of the registry.

Refs #12640.


Run Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Implements the #6003 design note's adopted semantics as a pure
registry state machine in a new library_attach module:

- attach/detach staged and applied only at tick boundaries; the
  TickSnapshot a boundary hands out is what invocations resolve
  against, so a mid-tick detach never pulls behaviour from an
  in-flight invocation;
- attach authorization: entity owner, or a world author holding an
  explicit attach capability on the entity's class;
- attach-time capability intersection: a library's requirement
  footprint must fit inside (entity held caps ∩ world ceiling);
  widening attaches are refused with the widening capabilities
  named exhaustively — borrowing a library never borrows its
  author's privileges;
- library state namespaced per (entity, library, major version):
  inert (kept, flagged where the design note requires) on detach
  and on minor upgrade without a declared migration, carried live
  across a minor upgrade with one, parked on major upgrade until
  the entity owner adopts or drops it.

20 new tests name their oracles (the design note's §1/§2/§3
rules); the full id-caps suite passes 199/199 and rustfmt is clean.
Runtime wiring (invocation dispatch through the snapshot, declared
migration execution, persistence) consumes this seam later.

Refs #12640.
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 04:44
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cfc60e69-0f7c-48e6-82f2-3160befa1ed3
Commits

Reviewing files that changed from the base of the PR and between bc47aa7 and f46bd99.

Files selected for processing: 2

  • pkgs/id/crates/id-caps/src/lib.rs
  • pkgs/id/crates/id-caps/src/library_attach.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T04:46:07.167528Z f46bd99 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 4120b0c into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-el/12640-library-attach branch November 23, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant